<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Jedrzej\Pimpable\PimpableTrait;

class StoreServiceFeedback extends Model
{
    use HasFactory;
    use PimpableTrait;
    use SoftDeletes;
    /**
     *允许批量赋值的字段
     */
    public $fillable = [
        'user_id',
        'name',
        'content',
        'make',
        'mer_id',
        'created_at',
    ];

    /**
     * 可搜索的字段
     */
    public $searchable = [
        'name',
        'phone',
        'content',
        'created_at',
    ];

    /**
     * 默认倒序
     */
    protected $defaultSortCriteria = ['id,desc'];

    /**
     * 关联用户模型
     */
    public function user()
    {
        return $this->belongsTo(User::class, 'user_id', 'id');
    }


    /**
     * 关联商户模型
     */
    public function mer()
    {
        return $this->belongsTo(MerchantRegister::class, 'mer_id', 'id');
    }
}
